﻿using System.Collections.Generic;

namespace Syngine.Components
{
	/// <summary>
	/// 
	/// </summary>
	public class DrawableList : DrawableList<IDraw>
	{
	}

	/// <summary>
	/// 
	/// </summary>
	/// <typeparam name="TDrawable">The type of the drawable.</typeparam>
	public class DrawableList<TDrawable> : List<TDrawable>, IDraw, ILoad where TDrawable : IDraw
	{
		public int DrawOrder { get; set; }

		public bool Visible { get; set; }

		public virtual void LoadContent(LoadContext context)
		{
			for (var i = 0; i < Count; i++)
			{
				this[i].LoadContent(context);
			}
		}

		public virtual void Draw(DrawContext context)
		{
			for (var i = 0; i < Count; i++)
			{
				this[i].Draw(context);
			}
		}

		public virtual void UnloadContent()
		{
			for (int i = 0; i < Count; i++)
			{
				this[i].UnloadContent();
			}
		}
	}
}
